package com.ming.springcloud.consumer.service;

import com.ming.springcloud.consumer.hystric.StudentServiceHystric;
import com.ming.springcloud.consumer.vo.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "student-service-provider", fallback = StudentServiceHystric.class)  //服务提供者的名字
public interface StudentService {
    @RequestMapping(value = "/student/info", method = RequestMethod.GET)
    String hello(@RequestParam(value = "name") String name);

    @RequestMapping(value = "/student/findAllStudents", method = RequestMethod.GET)
    String findAllStudents(@RequestParam(value = "name") String name);

    @RequestMapping(value = "/student/findStudentsById/{id}", method = RequestMethod.GET)
    String findStudentsById(@RequestParam(value = "name") String name,@RequestParam(value = "id") Integer id);

    @RequestMapping(value = "/student/delStudent/{id}", method = RequestMethod.GET)
    String delStudent(@RequestParam(value = "name") String name,@RequestParam(value = "id") Integer id);

    @RequestMapping(value = "/student/editStudent", method = RequestMethod.POST)
    String editStudent(@RequestParam(value = "name") String name, @RequestBody Student student);

    @RequestMapping(value = "/student/addStudent", method = RequestMethod.POST)
    String addStudent(@RequestParam(value = "name") String name, @RequestBody Student student);
}
